import { IPSAppWFUIActionGroup } from '../../app/wf/ipsapp-wfuiaction-group';
import { IPSUIActionGroupDetail } from '../../view/ipsuiaction-group-detail';
import { IPSWorkflow } from '../ipsworkflow';
import { IPSWFUIActionGroup } from './ipswfuiaction-group';
import { PSModelObjectImpl } from '../../psmodel-object-impl';

export class PSWFUIActionGroupImpl extends PSModelObjectImpl implements IPSWFUIActionGroup, IPSAppWFUIActionGroup {
  get codeName(): string {
    return this.M.codeName;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get groupTag(): string {
    return this.M.groupTag;
  }

  get groupTag2(): string {
    return this.M.groupTag2;
  }

  get groupTag3(): string {
    return this.M.groupTag3;
  }

  get groupTag4(): string {
    return this.M.groupTag4;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  protected psuiactiongroupdetails: IPSUIActionGroupDetail[] | null = null;

  getPSUIActionGroupDetails(): IPSUIActionGroupDetail[] | null {
    if (this.psuiactiongroupdetails == null) {
      this.psuiactiongroupdetails = this.fillChildListModel(this.M.getPSUIActionGroupDetails, 'view.IPSUIActionGroupDetail') as IPSUIActionGroupDetail[];
    }
    return this.psuiactiongroupdetails;
  }

  get psUIActionGroupDetails(): IPSUIActionGroupDetail[] | null {
    return this.getPSUIActionGroupDetails();
  }

  findPSUIActionGroupDetail(objKey: any): IPSUIActionGroupDetail | null {
    return this.getPSModel5('view.IPSUIActionGroupDetail', this.getPSUIActionGroupDetails(), objKey) as IPSUIActionGroupDetail;
  }

  protected psworkflow: IPSWorkflow | null = null;

  getPSWorkflow(): IPSWorkflow | null {
    if (this.psworkflow != null) return this.psworkflow;
    const value = this.M.getPSWorkflow;
    if (value == null) {
      return null;
    }
    this.psworkflow = this.getPSModel4('wf.IPSWorkflow', value, 'getPSWorkflow') as IPSWorkflow;
    return this.psworkflow;
  }

  get psWorkflow(): IPSWorkflow | null {
    return this.getPSWorkflow();
  }

  getPSWorkflowMust(): IPSWorkflow {
    const value = this.getPSWorkflow();
    if (value == null) {
      throw new Error('未指定工作流对象');
    }
    return value;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get cls(): string {
    return 'PSWFUIActionGroupImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'app.wf.IPSAppWFUIActionGroup' || cls == 'view.IPSUIActionGroup' || cls == 'wf.IPSWorkflowObject' || cls == 'wf.uiaction.IPSWFUIActionGroup') return true;
    return super.instanceof(cls);
  }
}
